//************************************************************************
//     dftypes.h
//     2009 © DigiFi Limited
//
//     This is the header file contains the types publicly used by the 
//     library
//
//************************************************************************


#ifndef DFTYPES_HEADER
#define DFTYPES_HEADER

// types of command
typedef enum {
	DF_VOID_COMMAND,
	DF_GET_COMMAND,
	DF_SET_COMMAND,
	DF_ROW_COMMAND,
	DF_RGET_COMMAND
} df_commandtype;

typedef enum {
	DF_STORAGE_UNKNOWN = 0,
	DF_STORAGE_SERVER = 1,
	DF_STORAGE_NETWORK = 2,
	DF_STORAGE_PORTABLE = 3
} df_storagetype;


struct __df_server {
	char *name;
	char *version;
	char *address;
	
	struct __df_server *next;
};

typedef struct __df_server df_server;


typedef struct {
	unsigned int hours;
	unsigned int minutes;
	unsigned int seconds;
} df_time;

typedef struct {
	unsigned int year;
	unsigned int month;
	unsigned int day;
} df_date;


typedef struct {
	int key;
	char *name;
	char *type;
	df_time *length;
	int source;
} df_track;

typedef struct {
	char *album;
	char *artist;
} df_albumartist;


typedef struct {
	int key;
	char *name;
	int albumkey;
	char *albumname;
	int artistkey;
	char *artistname;
	int genrekey;
	char *genrename;
	df_time *length;
	int source;
	char *path;
} df_detailedtrack;


typedef struct {
	char *name;
	int source;
	char *path;
} df_trackname;





// row structs
typedef struct {
	unsigned int id;
	unsigned int total;
	unsigned int count;
	unsigned int offset;
} df_rows;

typedef struct {
	char* command;
	unsigned int type;
	char* regex_name;
	void (*callback)(void);
	df_rows *pull_info;
} df_asyncpayload;




struct __df_row {
	struct __df_row *next;
};

typedef struct __df_row df_row;





struct __df_artistrow {
	struct __df_artistrow *next;
	
	int key;
	char *name;
};

typedef struct __df_artistrow df_artistrow;


struct __df_roomrow {
	struct __df_roomrow *next;
	
	int key;
	char *ipaddress;
	int channel;
	char *name;
	char *short_name;
	unsigned int is_multiroom;
	unsigned int playback_capability;
	unsigned int ripping_capability;
	unsigned int musicmanagement_capabaility;
	int id;
	char *host_name;
};

typedef struct __df_roomrow df_roomrow;


struct __df_albumrow {
	struct __df_albumrow *next;
	
	int key;
	char *name;
	int artist_key;
	char *artist_name;
	int is_album;
	df_date created_date;
	df_date last_modified_date;
	int hit_count;
	int extended_avaliable;
	df_storagetype storage;
};

typedef struct __df_albumrow df_albumrow;


struct __df_albumdetailrow {
	struct __df_albumdetailrow *next;
	
	int key;
	char *name;
	int artist_key;
	char *artist_name;
	int is_album;
	df_date created_date;
	df_date last_modified_date;
	int hit_count;
	int extended_avaliable;
	df_storagetype storage;
	char *genre;
	int track_count;
	char *cover_image;
};

typedef struct __df_albumdetailrow df_albumdetailrow;


struct __df_trackrow {
	struct __df_trackrow *next;
	
	int key;
	char *name;
	char *sort_name;
	char *type;
	df_time length;
	df_date created_date;
	df_date last_modified_date;
	int ordinal;
	int extended_avaliable;
	df_storagetype storage;
	int sample_rate;
	int bit_per_sample;
	int channel_count;
	int source;
};

typedef struct __df_trackrow df_trackrow;


struct __df_genrerow {
	struct __df_genrerow *next;
	
	int key;
	char *name;
	df_date created_date;
	df_date last_modified_date;
	int ordinal;
	df_storagetype storage;
};

typedef struct __df_genrerow df_genrerow;


struct __df_subgenrerow {
	struct __df_subgenrerow *next;
	
	int key;
	char *name;
	df_date created_date;
	df_date last_modified_date;
	int ordinal;
};

typedef struct __df_subgenrerow df_subgenrerow;


struct __df_trackinforow {
	struct __df_trackinforow *next;
	
	int key;
	char *name;
	char *sort_name;
	char *type;
	df_time length;
	df_date created_date;
	df_date last_modified_date;
	int ordinal;
	int extended_avaliable;
	df_storagetype storage;
	int sample_rate;
	int bits_per_sample;
	int channel_count;
	int album_key;
	char *album_name;
	int artist_key;
	char *artist_name;
};

typedef struct __df_trackinforow df_trackinforow;


struct __df_keyvaluerow {
	struct __df_keyvaluerow *next;
	
	char *key;
	char *value;
};

typedef struct __df_keyvaluerow df_keyvaluerow;

#endif